`include "define.v"
module INSTMEM(
input wire ce,
input wire [31:0] addr,
output reg [31:0] data
);

reg [31:0] instmem[1023:0];
always@(*)
if(ce==`Enable) data=instmem[addr[11:2]];
else            data=`Zero;

initial
	begin
	//lw?? ?????????

	instmem[0]=32'b100011_00000_00001_0000_0000_0000_0001;
	instmem[1]=32'b100011_00000_00010_0000_0000_0000_0010;
	instmem[2]=32'b100011_00000_00011_0000_0000_0000_0011;
	instmem[3]=32'b100011_00000_00100_0000_0000_0000_0100;
	instmem[4]=32'b100011_00000_00101_0000_0000_0000_0101;
	instmem[5]=32'b100011_00000_00110_0000_0000_0000_0110;
	instmem[6]=32'b100011_00000_00111_0000_0000_0000_0111;
	instmem[7]=32'b100011_00000_01000_0000_0000_0000_1000;
	instmem[8]=32'b100011_00000_01001_0000_0000_0000_1001;
	instmem[9]=32'b100011_00000_01010_0000_0000_0000_1010;
	instmem[10]=32'b100011_00000_01011_0000_0000_0000_1011;
	instmem[11]=32'b100011_00000_01100_0000_0000_0000_1100;
	instmem[12]=32'b100011_00000_01101_0000_0000_0000_1101;
	instmem[13]=32'b100011_00000_01110_0000_0000_0000_1110;
	instmem[14]=32'b100011_00000_01111_0000_0000_0000_1111;
	instmem[15]=32'b100011_00000_10000_0000_0000_0001_0000;
	instmem[16]=32'b100011_00000_10001_0000_0000_0001_0001;
	instmem[17]=32'b100011_00000_10010_0000_0000_0001_0010;
	instmem[18]=32'b100011_00000_10011_0000_0000_0001_0011;
	instmem[19]=32'b100011_00000_10100_0000_0000_0001_0100;
	instmem[20]=32'b100011_00000_10101_0000_0000_0001_0101;
	instmem[21]=32'b100011_00000_10110_0000_0000_0001_0110;
	instmem[22]=32'b100011_00000_10111_0000_0000_0001_0111;
	instmem[23]=32'b100011_00000_11000_0000_0000_0001_1000;
	instmem[24]=32'b100011_00000_11001_0000_0000_0001_1001;
	instmem[25]=32'b100011_00000_11010_0000_0000_0001_1010;
	instmem[26]=32'b100011_00000_11011_0000_0000_0001_1011;
	instmem[27]=32'b100011_00000_11100_0000_0000_0001_1100;
	instmem[28]=32'b100011_00000_11101_0000_0000_0001_1101;
	instmem[29]=32'b100011_00000_11110_0000_0000_0001_1110;


	//R instruction
	instmem[30]=32'b000000_00011_00010_00001_00000_100000;
	instmem[31]=32'b000000_00110_00101_00100_00000_100010;
	instmem[32]=32'b000000_01001_01000_00111_00000_100100;
	instmem[33]=32'b000000_01100_01011_01010_00000_100101;
	instmem[34]=32'b000000_01111_01110_01101_00000_100110;
	instmem[35]=32'b000000_00000_10001_10000_00011_001010;
	instmem[36]=32'b000000_00000_10100_10011_00011_000010;
	instmem[37]=32'b000000_00000_10111_10110_00011_000011;

	instmem[38]=32'b000100_10011_10110_0000_0000_0000_0010;

	//I instruction 
	instmem[39]=32'b000000_00000_10100_10011_00011_000010;
	instmem[40]=32'b000000_00000_10111_10110_00011_000011;
	instmem[41]=32'b000101_01110_01101_0000_0000_0000_0110;
	instmem[42]=32'b001001_00010_00001_0000_0000_0010_1000;
	instmem[43]=32'b001100_00100_00011_0000_0000_0000_1111;
	instmem[44]=32'b001101_00110_00101_0000_0000_0000_1111;
	instmem[45]=32'b001110_01000_00111_0000_0000_0000_1111;
	instmem[46]=32'b001111_00000_01111_0000_0000_0010_1000;
	instmem[47]=32'b000000_11111_00000_00000_00000_001000;
	instmem[48]=32'b000110_0000_0000_0000_0000_0000_110011;

	//J instruction
	instmem[49]=32'b001001_00010_00001_0000_0000_0010_1000;
	instmem[50]=32'b001100_00100_00011_0000_0000_0000_1111;
	instmem[51]=32'b000111_0000_0000_0000_0000_0000_101010;

	//extend instruction
	instmem[52]=32'b010111_00011_00000_0000_0000_0000_0010;
	instmem[53]=32'b001001_00010_00001_0000_0000_0010_1000;
	instmem[54]=32'b001100_00100_00011_0000_0000_0000_1111;
	instmem[55]=32'b000000_00011_00111_00011_00000_100010;
	instmem[56]=32'b000001_00011_00000_0000_0000_0000_0010;
	instmem[57]=32'b001001_00010_00001_0000_0000_0010_1000;
	instmem[58]=32'b001100_00100_00011_0000_0000_0000_1111;
	instmem[59]=32'b001001_00001_00011_0000_0000_1100_1110;
	instmem[60]=32'b000000_00011_00000_11111_00000_001011;
	instmem[61]=32'b001001_00001_00011_0000_0000_1100_1110;
	instmem[62]=32'b000000_00011_00001_00010_00000_101010;
	instmem[63]=32'b100011_00000_00010_0000_0000_0000_0010;
	instmem[64]=32'b100011_00000_00011_0000_0000_0000_0011;
	instmem[65]=32'b100011_00000_00100_0000_0000_0000_0100;
	instmem[66]=32'b000000_00010_00100_00001_00000_100010;
	instmem[67]=32'b000000_00010_00011_00000_00000_011001;		//???
	instmem[68]=32'b000000_00001_00011_00000_00000_011000;		//???
	instmem[69]=32'b000000_00011_00010_00000_00000_011011;		//wufuhao1
	instmem[70]=32'b000000_00011_00001_00000_00000_011010;		//???
	instmem[71]=32'b000000_00000_00000_00101_00000_010000;
	instmem[72]=32'b000000_00000_00000_00110_00000_010010;
	instmem[73]=32'b000000_00111_00000_00000_00000_010001;
	instmem[74]=32'b000000_01000_00000_00000_00000_010011;



	/*vivoda text
	instmem[0]=32'b100011_00000_00001_0000_0000_0000_0001;
	instmem[1]=32'b100011_00000_00010_0000_0000_0000_0010;
	instmem[2]=32'b100011_00000_00011_0000_0000_0000_0011;
	instmem[3]=32'b100011_00000_00100_0000_0000_0000_0100;
	instmem[4]=32'b100011_00000_00101_0000_0000_0000_0101;
	instmem[5]=32'b100011_00000_00110_0000_0000_0000_0110;
	instmem[6]=32'b100011_00000_00111_0000_0000_0000_0111;
	instmem[7]=32'b100011_00000_01000_0000_0000_0000_1000;

	instmem[8]=32'b101011_00000_00100_0111_0000_0000_0001;
	instmem[9]=32'b101011_00000_00101_0111_0000_0000_0010;
	instmem[10]=32'b101011_00000_00110_0111_0000_0000_0011;
	*/

	/*
	// VIVADO
	instmem[0]=32'b100011_00000_00001_0000_0000_0000_0001;
	instmem[1]=32'b101011_00000_00001_0111_0000_0000_0001;
	instmem[2]=32'b100011_00000_00010_0000_0000_0000_0010;
	instmem[3]=32'b101011_00000_00010_0111_0000_0000_0010;
	instmem[4]=32'b100011_00000_00011_0000_0000_0000_0011;
	instmem[5]=32'b101011_00000_00011_0111_0000_0000_0011;
	instmem[6]=32'b100011_00000_00100_0000_0000_0000_0100;
	instmem[7]=32'b101011_00000_00100_0111_0000_0000_0100;
	instmem[8]=32'b100011_00000_00101_0000_0000_0000_0101;
	instmem[9]=32'b101011_00000_00101_0111_0000_0000_0101;
	instmem[10]=32'b100011_00000_00110_0000_0000_0000_0110;
	instmem[11]=32'b101011_00000_00110_0111_0000_0000_0110;
	instmem[12]=32'b100011_00000_00111_0000_0000_0000_0111;
	instmem[13]=32'b101011_00000_00111_0111_0000_0000_0111;
	instmem[14]=32'b100011_00000_01000_0000_0000_0000_1000;
	instmem[15]=32'b101011_00000_01000_0111_0000_0000_1000;
	instmem[16]=32'b100011_00000_01001_0000_0000_0000_1001;
	instmem[17]=32'b101011_00000_01001_0111_0000_0000_1001;
	instmem[18]=32'b100011_00000_01010_0000_0000_0000_1010;
	instmem[19]=32'b101011_00000_01010_0111_0000_0000_1010;
	instmem[20]=32'b100011_00000_01011_0000_0000_0000_1011;
	instmem[21]=32'b101011_00000_01011_0111_0000_0000_1011;
	instmem[22]=32'b100011_00000_01100_0000_0000_0000_1100;
	instmem[23]=32'b101011_00000_01100_0111_0000_0000_1100;
	instmem[24]=32'b100011_00000_01101_0000_0000_0000_1101;
	instmem[25]=32'b101011_00000_01101_0111_0000_0000_1101;
	instmem[26]=32'b100011_00000_01110_0000_0000_0000_1110;
	instmem[27]=32'b101011_00000_01110_0111_0000_0000_1110;
	instmem[28]=32'b100011_00000_01111_0000_0000_0000_1111;
	instmem[29]=32'b101011_00000_01111_0111_0000_0000_1111;
	instmem[30]=32'b100011_00000_10000_0000_0000_0001_0000;
	instmem[31]=32'b101011_00000_10000_0111_0000_0001_0000;
	instmem[32]=32'b100011_00000_10001_0000_0000_0001_0001;
	instmem[33]=32'b101011_00000_10001_0111_0000_0001_0001;
	instmem[34]=32'b100011_00000_10010_0000_0000_0001_0010;
	instmem[35]=32'b101011_00000_10010_0111_0000_0001_0010;
	instmem[36]=32'b100011_00000_10011_0000_0000_0001_0011;
	instmem[37]=32'b101011_00000_10011_0111_0000_0001_0011;
	instmem[38]=32'b100011_00000_10100_0000_0000_0001_0100;
	instmem[39]=32'b101011_00000_10100_0111_0000_0001_0100;
	instmem[40]=32'b100011_00000_10101_0000_0000_0001_0101;
	instmem[41]=32'b101011_00000_10101_0111_0000_0001_0101;
	instmem[42]=32'b100011_00000_10110_0000_0000_0001_0110;
	instmem[43]=32'b101011_00000_10110_0111_0000_0001_0110;
	instmem[44]=32'b100011_00000_10111_0000_0000_0001_0111;
	instmem[45]=32'b101011_00000_10111_0111_0000_0001_0111;
	instmem[46]=32'b100011_00000_11000_0000_0000_0001_1000;
	instmem[47]=32'b101011_00000_11000_0111_0000_0001_1000;
	instmem[48]=32'b100011_00000_11001_0000_0000_0001_1001;
	instmem[49]=32'b101011_00000_11001_0111_0000_0001_1001;
	instmem[50]=32'b100011_00000_11010_0000_0000_0001_1010;
	instmem[51]=32'b101011_00000_11010_0111_0000_0001_1010;
	instmem[52]=32'b100011_00000_11011_0000_0000_0001_1011;
	instmem[53]=32'b101011_00000_11011_0111_0000_0001_1011;
	instmem[54]=32'b100011_00000_11100_0000_0000_0001_1100;
	instmem[55]=32'b101011_00000_11100_0111_0000_0001_1100;
	instmem[56]=32'b100011_00000_11101_0000_0000_0001_1101;
	instmem[57]=32'b101011_00000_11101_0111_0000_0001_1101;
	instmem[58]=32'b100011_00000_11110_0000_0000_0001_1110;
	instmem[59]=32'b101011_00000_11110_0111_0000_0001_1110;

	//R instruction
	instmem[60]=32'b000000_00011_00010_00001_00000_100000;
	instmem[61]=32'b101011_00000_00001_0111_0000_0001_1111;
	instmem[62]=32'b000000_00110_00101_00100_00000_100010;
	instmem[63]=32'b101011_00000_00100_0111_0000_0010_0000;
	instmem[64]=32'b000000_01001_01000_00111_00000_100100;
	instmem[65]=32'b101011_00000_00111_0111_0000_0010_0001;
	instmem[66]=32'b000000_01100_01011_01010_00000_100101;
	instmem[67]=32'b101011_00000_01010_0111_0000_0010_0010;
	instmem[68]=32'b000000_01111_01110_01101_00000_100110;
	instmem[69]=32'b101011_00000_01101_0111_0000_0010_0011;
	instmem[70]=32'b000000_00000_10001_10000_00011_001010;
	instmem[71]=32'b101011_00000_10000_0111_0000_0010_0100;
	instmem[72]=32'b000000_00000_10100_10011_00011_000010;
	instmem[73]=32'b101011_00000_10011_0111_0000_0010_0101;
	instmem[74]=32'b000000_00000_10111_10110_00011_000011;
	instmem[75]=32'b101011_00000_10110_0111_0000_0010_0110;

	instmem[76]=32'b000100_10011_10110_0000_0000_0000_0100;    //jump


	//I instruction 
	instmem[77]=32'b000000_00000_10100_10011_00011_000010;
	instmem[78]=32'b101011_00000_10110_0111_0000_0010_0111;
	instmem[79]=32'b000000_00000_10111_10110_00011_000011;
	instmem[80]=32'b101011_00000_10110_0111_0000_0010_1000;


	instmem[81]=32'b000101_01110_01101_0000_0000_0000_1011;

	instmem[82]=32'b001001_00010_00001_0000_0000_0010_1000;
	instmem[83]=32'b101011_00000_00001_0111_0000_0010_1001;
	instmem[84]=32'b001100_00100_00011_0000_0000_0000_1111;
	instmem[85]=32'b101011_00000_00011_0111_0000_0010_1010;
	instmem[86]=32'b001101_00110_00101_0000_0000_0000_1111;
	instmem[87]=32'b101011_00000_00101_0111_0000_0010_1011;
	instmem[88]=32'b001110_01000_00111_0000_0000_0000_1111;
	instmem[89]=32'b101011_00000_00111_0111_0000_0010_1100;
	instmem[90]=32'b001111_00000_01111_0000_0000_0010_1000;
	instmem[91]=32'b101011_00000_01111_0111_0000_0010_1101;

	instmem[92]=32'b000000_11111_00000_00000_00000_001000;
	instmem[93]=32'b000110_0000_0000_0000_0000_0001_100010;

	//J instruction
	instmem[94]=32'b001001_00010_00001_0000_0000_0010_1000;
	instmem[95]=32'b101011_00000_00001_0111_0000_0010_1110;
	instmem[96]=32'b001100_00100_00011_0000_0000_0000_1111;
	instmem[97]=32'b101011_00000_00011_0111_0000_0010_1111;

	instmem[98]=32'b000111_0000_0000_0000_0000_0001_010010;   



	//extend instruction
	instmem[99]=32'b010111_00011_00000_0000_0000_0000_0100;
	instmem[100]=32'b001001_00010_00001_0000_0000_0010_1000;
	instmem[101]=32'b101011_00000_00011_0111_0000_0011_0000;
	instmem[102]=32'b001100_00100_00011_0000_0000_0000_1111;
	instmem[103]=32'b101011_00000_00011_0111_0000_0011_0001;
	instmem[104]=32'b000000_00011_00111_00011_00000_100010;
	instmem[105]=32'b101011_00000_00011_0111_0000_0011_0010;

	instmem[106]=32'b000001_00011_00000_0000_0000_0000_0100;
	instmem[107]=32'b001001_00010_00001_0000_0000_0010_1000;
	instmem[108]=32'b101011_00000_00011_0111_0000_0011_0011;
	instmem[109]=32'b001100_00100_00011_0000_0000_0000_1111;
	instmem[110]=32'b101011_00000_00011_0111_0000_0011_0100;
	instmem[111]=32'b001001_00001_00011_0000_0001_1010_0110;
	instmem[112]=32'b101011_00000_00011_0111_0000_0011_0101;

	instmem[113]=32'b000000_00011_00000_11111_00000_001011;
	instmem[114]=32'b001001_00001_00011_0000_0000_1100_1110;
	instmem[115]=32'b101011_00000_00011_0111_0000_0011_0110;
	instmem[116]=32'b000000_00011_00001_00010_00000_101010;
	instmem[117]=32'b101011_00000_00011_0111_0000_0011_0111;
	instmem[118]=32'b100011_00000_00010_0000_0000_0000_0010;
	instmem[119]=32'b101011_00000_00011_0111_0000_0011_1000;
	instmem[120]=32'b100011_00000_00011_0000_0000_0000_0011;
	instmem[121]=32'b101011_00000_00011_0111_0000_0011_1001;
	instmem[122]=32'b100011_00000_00100_0000_0000_0000_0100;
	instmem[123]=32'b101011_00000_00011_0111_0000_0011_1010;
	instmem[124]=32'b000000_00010_00100_00001_00000_100010;
	instmem[125]=32'b101011_00000_00011_0111_0000_0011_1011;
	*/


	/*
	instmem[67]=32'b000000_00010_00011_00000_00000_011001;		//???
	instmem[68]=32'b000000_00001_00011_00000_00000_011000;		//???
	instmem[69]=32'b000000_00011_00010_00000_00000_011011;		//wufuhao1
	instmem[70]=32'b000000_00011_00001_00000_00000_011010;		//???
	instmem[71]=32'b000000_00000_00000_00101_00000_010000;
	instmem[72]=32'b000000_00000_00000_00110_00000_010010;
	instmem[73]=32'b000000_00111_00000_00000_00000_010001;
	instmem[74]=32'b000000_01000_00000_00000_00000_010011;
	*/


	//flue light
	/*
	instmem[0]=32'b001101_00000_00001_0000_0000_1111_1111;
	instmem[1]=32'b101011_00000_00001_0111_0000_0000_0001;

	instmem[2]=32'b001101_00000_00001_0000_0000_0111_1111;
	instmem[3]=32'b101011_00000_00001_0111_0000_0000_0001;

	instmem[4]=32'b001101_00000_00001_0000_0000_0011_1111;
	instmem[5]=32'b101011_00000_00001_0111_0000_0000_0001;

	instmem[6]=32'b001101_00000_00001_0000_0000_0001_1111;
	instmem[7]=32'b101011_00000_00001_0111_0000_0000_0001;

	instmem[8]=32'b001101_00000_00001_0000_0000_0000_1111;
	instmem[9]=32'b101011_00000_00001_0111_0000_0000_0001;

	instmem[10]=32'b001101_00000_00001_0000_0000_0000_0111;
	instmem[11]=32'b101011_00000_00001_0111_0000_0000_0001;

	instmem[12]=32'b001101_00000_00001_0000_0000_0000_0011;
	instmem[13]=32'b101011_00000_00001_0111_0000_0000_0001;

	instmem[14]=32'b001101_00000_00001_0000_0000_0000_0111;
	instmem[15]=32'b101011_00000_00001_0111_0000_0000_0001;

	instmem[16]=32'b001101_00000_00001_0000_0000_0000_1111;
	instmem[17]=32'b101011_00000_00001_0111_0000_0000_0001;

	instmem[18]=32'b001101_00000_00001_0000_0000_0001_1111;
	instmem[19]=32'b101011_00000_00001_0111_0000_0000_0001;

	instmem[20]=32'b001101_00000_00001_0000_0000_0011_1111;
	instmem[21]=32'b101011_00000_00001_0111_0000_0000_0001;

	instmem[22]=32'b001101_00000_00001_0000_0000_0111_1111;
	instmem[23]=32'b101011_00000_00001_0111_0000_0000_0001;


	instmem[24]=32'b000110_0000_0000_0000_0000_0000_000000;
	*/
	end
endmodule 

